//
//  PlayScreen.h
//  TestFistGame
//
//  Created by  on 5/17/12.
//  Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//

#import "GameLayer.h"
#import "cocos2d.h"
#import "Video.h"
#import "Sound.h"
#import "ConstructionGround.h"
#import "MapData.h"
#import "DemoCastle.h"
#import "Goblin.h"
#import "BoomTower.h"
#import "MagicTower.h"
#import "FastTower.h"
#import "StoneBullet.h"
#import "EnemyInfo.h"
#import "DemonLord.h"
#import "Hound.h"
#import "Soldier.h"
#import "SoldierFromBarrack.h"
#import "Gargoygle.h"
#import "Hero.h"
#import "FireDropObject.h"
#import "SilverLightObject.h"
#import "SkillEffectObject.h"
#import "Summoner.h"

enum {
    TAG_CONSTRUCT_TOWER_STICK_NOTE_SPRITE = 0,
    TAG_PLAYER_MONEY_ICON = 1,
    TAG_PLAYER_LIFE_ICON = 2,
    TAG_PLAYER_STAR_ICON = 3
};

@interface PlayScreen : GameLayer {
    CGSize windowsSize;
    
    MapData *gameMapData;
    
    CCTMXTiledMap *mapBackgroundSprite;
    
    CCLabelTTF *playerNameText;
    CCLabelTTF *moneyCountText;
    CCLabelTTF *lifeCountText;
    CCLabelTTF *starCountText;
    
    //table contain tower icon
    //variable for construct Tower, select tower, upgrade tower
    CCSprite *rightTableContain;
    ConstructionGround *groundIsSelected;
    GameObject *towerIsSelected;
    
    CCMenu *fireSkillButton;
    CCMenu *silverLightSkillButton;
    CCSprite *blackSpriteOfFireSkill;
    CCSprite *blackSpriteOfLightSkill;
    CCSprite *lightningEffect;
    CCSprite *fireEffect;
    int fireSkillCountDown;
    int lightkillCountDown;
    
    CCMenu *startWaveMenu;
    CCMenu *callHeroMenu;
    
    float scaleRate;
    BOOL zoomIn;
    int enemyIndex;
    int waveIndex;
    BOOL setRallyPointMode;
    BOOL gestureAdded;
    BarrackTower *temp;
    
    UITapGestureRecognizer *singleTap;
    UITapGestureRecognizer *doubleTap;
    UIPanGestureRecognizer *recognizerTap;
    
    BOOL victoryCondition;
}

@property (retain, nonatomic) MapData *gameMapData;
@property (retain, nonatomic) CCTMXTiledMap *mapBackgroundSprite;
@property (retain, nonatomic) BarrackTower *temp;
@property (nonatomic) BOOL setRallyPointMode;

-(id)initPlayScreenWith:(iCoreGUIController *)_mainGUIController withMapDataXmlFile:(NSString *)_mapXmlFile;
-(void)loadMapData:(NSString *)_mapDataXmlFileName;
-(void)loadResources:(NSString *)_mapXmlFile;
-(void)loadGameComponents;

-(void)drawMap;
-(void)drawPlayerInfo;
-(void)drawSpecialAttack;
-(void)drawStartWaveCircle;
-(void)drawCallHeroButton;

-(void)drawRightTableContainTowerIcon;
-(void)hideRightTableContainTowerIconButtonPress;
-(void)toggleVisibleStateRightTableContainTowerIcon;
-(void)sharkRightTableContainTowerIcon;

-(void)constructionGroundPress:(id)sender;
-(void)createBoomTowerOnConstructionGround;
-(void)createMagicTowerOnConstructionGround;
-(void)createBarrackTowerOnConstructionGround;
-(void)createFastTowerOnConstructionGround;
-(void)sellTower:(GameObject *)_towerObject;

-(void)createEnemyWithEnemyInfo:(EnemyInfo*)_enemyInfo;
-(void)fireEnemy:(CGPoint)_targetPoint tower:(GameObject *)tower bullet:(GameObject *)_bullet;
-(void)enemyRunOverDestination:(GameObject *)_enemy;

- (CGPoint)boundLayerPos:(CGPoint)newPos;
-(float)randomFloatBetween:(float)smallNumber and:(float)bigNumber;
-(BOOL)pointIsInRect:(CGPoint)point withRect:(CGRect)rect;

-(void)callFireDropAttack:(id)sender;
-(void)callSilverLightAttack:(id)sender;

-(void)fullSkillCountDown;
-(int)directionFromPoint:(CGPoint)_pointStart toDestinationPoint:(CGPoint)_pointEnd;

-(void)showVictoryScreen;

@end
